<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
  <style>
    .outer {
      width: 400px;
      height: 600px;
      background: red;
    }

    .inner {
      width: 50%;
      padding-bottom: 50%;
      background: blue;
    }
  </style>
</head>

<body>
  <div class="outer">
    <div class="inner">哈哈哈哈</div>
  </div>
</body>

</html>